//
//  MyRatingListVC.m
//  test
//
//  Created by 朱圳 on 2018/3/14.
//  Copyright © 2018年 朱圳. All rights reserved.
//

#import "MyRatingListVC.h"
#import "MyRatingDetailVC.h"

@interface MyRatingListVC ()<UITableViewDelegate,UITableViewDataSource>
@property(strong,nonatomic)NSArray*list;
@property(nonatomic,strong)UITableView *tableView;

@end

@implementation MyRatingListVC

- (void)viewDidLoad {
    [super viewDidLoad];
   
    self.list = @[@"卓越",@"非常满意",@"满意",@"一般",@"差评"];
    self.title = @"选择评级";
    [self.view addSubview:self.tableView];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}
#pragma mark - Table view data source

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
    
    return 1;
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
    
    return self.list.count;
}
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
    
    static NSString *SimpleTableIdentifier = @"cell";
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:SimpleTableIdentifier];
    if (cell ==nil) {
        cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier: SimpleTableIdentifier];
        cell.accessoryType=UITableViewCellAccessoryDisclosureIndicator;
        cell.selectionStyle = UITableViewCellSelectionStyleNone;
        
    }
    if (indexPath.row == 4) {
        cell.textLabel.textColor = [UIColor redColor];
    }
    cell.textLabel.text = self.list[indexPath.row];
    return cell;
}
-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
    MyRatingDetailVC *vc = [[MyRatingDetailVC alloc]init];
    vc.title = self.list[indexPath.row];
    vc.questionID = self.questionID;
    vc.star = [NSString stringWithFormat:@"%ld",indexPath.row + 1];
    [self.navigationController pushViewController:vc animated:YES];
}
-(UITableView *)tableView{
    if (!_tableView) {
        _tableView = [[UITableView alloc]initWithFrame:CGRectMake(0, 0, ScreenWidth, ScreenHeight)];
        _tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
        _tableView.backgroundColor = [UIColor whiteColor];
        _tableView.tableFooterView = [[UIView alloc]init];
        _tableView.delegate = self;
        _tableView.dataSource = self;
    }
    return _tableView;
}
@end
